{	Problem: http://codeforces.ru/problemset/problem/92/C
	Verdict: Accepted
}
uses
        SysUtils, Math;

type
        dp='a'..'z';

var
        i,ls,lt,ans,tt,cur:longint;
        s,t,x:string;
        a:array[dp] of boolean;
        k:array[dp] of array of longint;
        ch:char;

begin
fillchar(a,sizeof(a),0);
fillchar(k,sizeof(k),0);
for ch:='a' to 'z' do 
        setlength(k[ch],1);
readln(s);
ls:=length(s);
for i:=1 to ls do
        a[s[i]]:=true;
readln(t);
lt:=length(T);
for i:=1 to lt do
        if not a[t[i]] then begin
                write(-1);
                halt(0);
        end;
fillchar(a,sizeof(a),0);
for i:=1 to lt do 
        a[t[i]]:=true;
x:=s;
s:='';
for i:=1 to ls do
        if a[x[i]] then s:=s+x[i];
ls:=length(s);
for i:=1 to ls do begin
        ch:=s[i];
        tt:=length(k[ch]);
        setlength(k[ch],tt+1);
        k[ch][tt]:=i;
end;
i:=1;
ans:=0;
for ch:='a' to 'z' do
        k[ch][0]:=1;
while i<=lt do begin
        inc(ans);
        ch:=t[i];
        cur:=1;
        tt:=length(k[ch])-1;
        while (k[ch][0]<=tt) do begin
                if k[ch][k[ch][0]]>=cur then begin
                        inc(i);
                        cur:=k[ch][k[ch][0]];
                        inc(k[ch][0]);
                        if i<=lt then begin
                                ch:=t[i];
                                tt:=length(k[ch])-1;
                        end else break;
                end else inc(k[ch][0]);
        end;            
        for ch:='a' to 'z' do
                k[ch][0]:=1;
end;
write(ans);
end.